"""
mysql.py
"""
import pymysql

# db = pymysql.connect(host='localhost', port=3306, user='root', password='123456', database='stu', charset='utf8')

kwargs = {
    'host': 'localhost',
    'port': 3306,
    'user': 'root',
    'password': '123456',
    'database': 'stu',
    'charset': 'utf8'
}
# 连接数据库\生成游标
db = pymysql.connect(**kwargs)  # 解压字典传参
cur = db.cursor()

# 操作数据 读/写


# 关闭游标\断开数据库连接
cur.close()
db.close()
